package day216;

public class ArrayDemo {
    public static void main(String[] args) {
        /*
        int[] arr1=new int[9];//声明一个整型数组arr1,包含9个元素,里面元素全是整型,默认值为0
        int[] arr2={1,2,3};
        int[] arr3=new int[]{1,2,3};
        int[] arr;
        arr=new int[]{1,2,3};
        int[] arr1=new int[5];
        int[] arr2={1,2,3};
        int[] arr=new int[]{1,2,3};

        int[] arr4={1,2,3};

        int[] arr4;
        arr4={1,2,3};//编译错误,此方式只能声明同时初始化;

        int[] arr=new int[5];
        System.out.println(arr.length);
        System.out.println(arr[0]);
        arr[0]=100;
        arr[1]=200;
        arr[4]=500;
        System.out.println(arr[arr.length-1]);
        //ArrayIndexOutOfBoundsException;数组小标越界异常

         */
        int[] arr=new int[10];
        for(int i=0;i<=arr.length;i++){
            arr[i]=(int)(Math.random()*100);
            System.out.println(arr[i]);
        }





































    }
}
